package com.example.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/calc")
public class CalcController {

    @RequestMapping(value = "/sum",method = {RequestMethod.GET,RequestMethod.POST})
    public String sum(@RequestParam Integer num1,
                      @RequestParam Integer num2){
        int sum = num1 + num2;
        return "计算机的计算结果为: " + sum;
    }
}
